<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue的响应式</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app">
        <div>Price :￥{{Price}}</div>
        <div>Total:￥{{price * quantity}}</div>
        <div>Taxes:￥{{totalPricewithTax}}</div>
        <button @click="changePrice">改变价格</button>
    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data(){
                return {
                    price:5.0,
                    quantity:2
                };
            },
            computed:{
                totalPricewithTax(){
                    return this.price * this.quantity * 1.03;
                }
            },
            methods: {
                changePrice(){
                    this.price=10;
                }
            }
        })
    </script>
</body>
</html>